package com.kakavr.base.resource;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import com.kakavr.base.log.BaseLog;

public class BaseContext extends BaseLog implements ApplicationContextAware {
	private static ApplicationContext applicationContext;

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		BaseContext.applicationContext = applicationContext;
	}
	
	public static Object getService(String serviceName) {
    	sdebug("SERVICE:"+applicationContext);
    	sdebug("SERVICE:"+serviceName);
        return applicationContext.getBean(serviceName);
    }

}
